<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>提示信息</title>
    <style type="text/css">
        *{ padding:0; margin:0; font-size:12px}
        .showMsg .guery {white-space: pre-wrap; /* css-3 */white-space: -moz-pre-wrap; /* Mozilla, since 1999 */white-space: -pre-wrap; /* Opera 4-6 */white-space: -o-pre-wrap; /* Opera 7 */	word-wrap: break-word; /* Internet Explorer 5.5+ */}
        a:link,a:visited{text-decoration:none;color:#0068a6}
        a:hover,a:active{color:#ff6600;text-decoration: underline}
        .showMsg{border: 1px solid #1e64c8; zoom:1; width:600px; height:250px;position:absolute;top:50%;left:50%;margin:-120px 0 0 -315px}
        .showMsg h5{background:#6c6c6c;background-repeat: no-repeat; color:#fff; padding-left:35px; height:25px; line-height:26px;*line-height:28px; overflow:hidden; font-size:14px; text-align:left}
        .showMsg .content{  font-size:16px; height:66px;margin-top: 50px;}
        .showMsg .bottom{ background:#e4ecf7;line-height:26px; *line-height:30px; height:26px; text-align:center;margin-top: 83px;}

    </style>
</head>
<body>

<div class="showMsg" style="text-align:center">
    <h5>提示信息</h5>
    <div class="content guery" style="display:inline-block;display:-moz-inline-stack;zoom:1;*display:inline; max-width:280px">
       <p>"找回密码邮件"已经发送至您的邮箱 <span id="mail" style="color: red;"><?php echo $usermail;?></span></p>
        <div style="margin-top: -50px;*margin-top: 20px;width:345px;">
            <table width="100%">
                <tr>
                    <td><label>验证码：</label></td>
                    <td><input type="text" id="vcode" name="vcode" size="5" class="input-text" ></td>
                    <td><img id='code_img' onclick='this.src=this.src+"&"+Math.random()' src='/?c=member&a=show_verify'></td>
                    <td><input type="button" id="submit" value="N秒后可重新发送" disabled="disabled"></td>
                </tr>
            </table>
        </div>
       <p style="margin-top: -30px;*margin-top: 50px;"><a href="#" target="_blank" id="mail_url">登录邮箱</a></p>
    </div>
    <div class="bottom">
        <a href="javascript:history.back();" >[点这里返回上一页]</a>
    </div>
</div>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script language="JavaScript">
    var flag = 0;
    var countdown;//定时器
    $(function(){
        var usermail = $("#mail").text();
        if (usermail){
            var t = usermail.match(/@(.*)/);
            url = "http://mail."+t[1];
            $("#mail_url").attr('href',url);
        }

        $('#submit').click(function () {
            flag = flag + 1;
            var obj = $(this);
            var count = 60;
            function CountDown() {
                var obj = $('#submit');
                obj.attr("disabled", true);
                obj.val( count + " 秒后可重新发送!");
                if (count == 0) {
                    obj.val("发送密码重置邮件").removeAttr("disabled");
                    clearInterval(countdown);
                }
                count--;
            }
            //判断按钮是否可用
            if(flag>1){
                var vcode = $("#vcode");
                var usermail = '<?php echo $usermail;?>';
                var sid = '<?php echo session_id();?>';
                if (!vcode.val()){
                    return vcode.focus();
                }
                $.ajax({
                    type: "POST",
                    dataType: 'json',
                    url : "/?c=member&a=send_pwd_mail",
                    data: { vcode:vcode.val(),mail: usermail,sid:sid},
                    beforeSend: function () { },
                    success: function (data) {
                        if (data.code==0){
                            alert(data.msg);
                        }else{
                            countdown = setInterval(CountDown, 1000);
                        }
                    },
                    error :function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(XMLHttpRequest.status);
                    }
                });
                //更换验证码
                $("#code_img").click();
            }else if(flag==1){
                countdown = setInterval(CountDown, 1000);
            }
        });
        $('#submit').click();
    });
</script>
</body>
</html>